package demo3;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
    @Autowired//自动装配
//    private Shirt shirt;//person 需要使用shirt时，将其定义为一个属性
//    private Sweater sweater;
    @Qualifier("summer")

    private Clothes clothes;
    //抛出NoUniqueBeanDefinitionException异常是因为毛衣和短袖都符合条件
    /**
     * 解决装配冲突：
     * 1.
     * */
    public void play(){
//        Shirt shirt = new Shirt();
//        shirt.wear();
//        sweater.wear();
        clothes.wear();
        System.out.println("出去玩");
    }
}
